package com.dj.common.web.vo;

import java.io.Serializable;
import java.util.Map;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor 
@NoArgsConstructor
public class EasyuiPage implements Serializable{
	private static final long serialVersionUID = 6994544757963321519L;
	/**当前页**/
	
	private int currentPage;
	/**每页数**/
	private int pageSize=10;
	/**总数**/
	private int total = 1;
	/***页数**/
	private int pageNo = 1;
	
	private int page = 0;

	private JSONArray rows;
	public EasyuiPage(JSONArray rows){
		this.rows = rows;
	}
	public EasyuiPage(JSONObject jo){
		this.rows = jo.getJSONArray("content");
		this.currentPage = jo.getIntValue("number");
		this.pageSize = jo.getIntValue("size");
		this.total = jo.getIntValue("totalElements");
		this.pageNo = jo.getIntValue("totalPages");
	}
	public void setParams(Map<String,Object> params) {
		params.put("page", this.page-1);
		params.put("size", this.pageSize);
	}
}
